var px ="px";
var content1_index = 0;
var content2_index = 0;
var pagecount_index = 0;
var header_index = 0;

function ajaxManager()
	{
	var args = ajaxManager.arguments;
	var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	switch (args[0])
		{
		case "load_page":
			if (document.getElementById)
				{
				document.getElementById("contentLYR").style.left = 2000+px;				
				}
			if (x)
				{
				x.onreadystatechange = function()
					{
					if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(args[2]);
						el.innerHTML = x.responseText;
						glideContent();
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;
		case "display_info":
			document.getElementById(args[2]).innerHTML = args[1];		
			break;
	case "start_up":
	    setArrays();
		glideContent();
		ajaxManager('load_page', content1Array[content1_index], 'column1LYR');
		ajaxManager('load_page', content2Array[content2_index], 'column2LYR');
		ajaxManager('display_info', pagecountArray[pagecount_index], 'pagecountLYR');
		ajaxManager('display_info', headerArray[header_index], 'headerLYR');
		ajaxManager('load_page', 'content/introduction.html', 'footerLYR');
			break;
		}
	}
	
function cycleContent(dir) {
if (dir == 'forw' && content1_index != content1Array.length - 1)
				{
				content1_index++;
				content2_index++;
				pagecount_index++;
				header_index++;
				ajaxManager('load_page', content1Array[content1_index], 'column1LYR');
				ajaxManager('load_page', content2Array[content2_index], 'column2LYR');
				ajaxManager('display_info', pagecountArray[pagecount_index], 'pagecountLYR');
				ajaxManager('display_info', headerArray[header_index], 'headerLYR');
				}
			else if (dir == 'rev' && content1_index != 0)
				{
				content1_index--;
				content2_index--;
				pagecount_index--;
				header_index--;
				ajaxManager('load_page', content1Array[content1_index], 'column1LYR');
				ajaxManager('load_page', content2Array[content2_index], 'column2LYR');
				ajaxManager('display_info', pagecountArray[pagecount_index], 'pagecountLYR');
				ajaxManager('display_info', headerArray[header_index], 'headerLYR');
				}
			}
function glideContent()
 {
var timer1 = null;
var steps = 20;
var decrease = 0.09;
 if (document.getElementById)
  {
  endPos = document.body.offsetLeft;
  el = document.getElementById("contentLYR");
  }
 el.xpos = el.offsetLeft;
 if (el.xpos < endPos)
  {
  clearTimeout(timer1);
  }
 else if (el.xpos >= endPos)
  {
  clearTimeout(timer1);
  }
 distance = endPos - el.xpos + 5;
 steps = distance * decrease;
 el.xpos += steps;
 el.style.left = el.xpos + px;
 timer1 = setTimeout("glideContent()", 25);
}

function setArrays() {
            content1Array = new Array();
			content1Array[0] = "content/intro1_column1.html";
			content1Array[1] = "content/intro2_column1.html";
			content1Array[2] = "content/intro3_column1.html";
			content1Array[3] = "content/intro4_column1.html";
			content1Array[4] = "content/intro5_column1.html";
			content1Array[5] = "content/intro6_column1.html";
			content1Array[6] = "content/basicsxml1_column1.html";
			content1Array[7] = "content/ajaxmanager1_column1.html";
			content1Array[8] = "content/ajaxmanager2_column1.html";
			content1Array[9] = "content/ajaxmanager3_column1.html";
			content1Array[10] = "content/ajaxmanager4_column1.html";
			content1Array[11] = "content/ajaxmanager5_column1.html";
			content1Array[12] = "content/ajaxmanager6_column1.html";
			content1Array[13] = "content/ajaxmanager7_column1.html";
			content1Array[14] = "content/ajaxmanager8_column1.html";
			content1Array[15] = "content/xmlpractical1_column1.html";
			content1Array[16] = "content/xmlpractical2_column1.html";
			content1Array[17] = "content/xmlpractical3_column1.html";
			content1Array[18] = "content/xmlpractical4_column1.html";
			content1Array[19] = "content/xmlpractical5_column1.html";
			content1Array[20] = "content/importdocs1_column1.html";
			content1Array[21] = "content/importdocs2_column1.html";
			content1Array[22] = "content/importdocs3_column1.html";
			content1Array[23] = "content/importjs1_column1.html";
			content1Array[24] = "content/importjs2_column1.html";
			content1Array[25] = "content/importjs3_column1.html";
			content1Array[26] = "content/gallery1_column1.html";
			content1Array[27] = "content/gallery2_column1.html";
			content1Array[28] = "content/gallery3_column1.html";
			content1Array[29] = "content/gallery4_column1.html";
			content1Array[30] = "content/gallery5_column1.html";
			content1Array[31] = "content/gallery6_column1.html";
			content1Array[32] = "content/gallery7_column1.html";
			content1Array[33] = "content/gallery8_column1.html";
			content1Array[34] = "content/gallery9_column1.html";
			content1Array[35] = "content/next1_column1.html";
			content1Array[36] = "content/next2_column1.html";
			
			content2Array = new Array();
			content2Array[0] = "content/intro1_column2.html";
			content2Array[1] = "content/intro2_column2.html";
			content2Array[2] = "content/intro3_column2.html";
			content2Array[3] = "content/intro4_column2.html";
			content2Array[4] = "content/intro5_column2.html";
			content2Array[5] = "content/intro6_column2.html";
			content2Array[6] = "content/basicsxml1_column2.html";
			content2Array[7] = "content/ajaxmanager1_column2.html";
			content2Array[8] = "content/ajaxmanager2_column2.html";
			content2Array[9] = "content/ajaxmanager3_column2.html";
			content2Array[10] = "content/ajaxmanager4_column2.html";
			content2Array[11] = "content/ajaxmanager5_column2.html";
			content2Array[12] = "content/ajaxmanager6_column2.html";
			content2Array[13] = "content/ajaxmanager7_column2.html";
			content2Array[14] = "content/ajaxmanager8_column2.html";
			content2Array[15] = "content/xmlpractical1_column2.html";
			content2Array[16] = "content/xmlpractical2_column2.html";
			content2Array[17] = "content/xmlpractical3_column2.html";
			content2Array[18] = "content/xmlpractical4_column2.html";
			content2Array[19] = "content/xmlpractical5_column2.html";
			content2Array[20] = "content/importdocs1_column2.html";
			content2Array[21] = "content/importdocs2_column2.html";
			content2Array[22] = "content/importdocs3_column2.html";
			content2Array[23] = "content/importjs1_column2.html";
			content2Array[24] = "content/importjs2_column2.html";
			content2Array[25] = "content/importjs3_column2.html";
			content2Array[26] = "content/gallery1_column2.html";
			content2Array[27] = "content/gallery2_column2.html";
			content2Array[28] = "content/gallery3_column2.html";
			content2Array[29] = "content/gallery4_column2.html";
			content2Array[30] = "content/gallery5_column2.html";
			content2Array[31] = "content/gallery6_column2.html";
			content2Array[32] = "content/gallery7_column2.html";
			content2Array[33] = "content/gallery8_column2.html";
			content2Array[34] = "content/gallery9_column2.html";
			content2Array[35] = "content/next1_column2.html";
			content2Array[36] = "content/next2_column2.html";
			
			pagecountArray = new Array();
			pagecountArray[0] = "Page 1 of 37";
			pagecountArray[1] = "Page 2 of 37";
			pagecountArray[2] = "Page 3 of 37";
			pagecountArray[3] = "Page 4 of 37";
			pagecountArray[4] = "Page 5 of 37";
			pagecountArray[5] = "Page 6 of 37";
			pagecountArray[6] = "Page 7 of 37";
			pagecountArray[7] = "Page 8 of 37";
			pagecountArray[8] = "Page 9 of 37";
			pagecountArray[9] = "Page 10 of 37";
			pagecountArray[10] = "Page 11 of 37";
			pagecountArray[11] = "Page 12 of 37";
			pagecountArray[12] = "Page 13 of 37";
			pagecountArray[13] = "Page 14 of 37";
			pagecountArray[14] = "Page 15 of 37";
			pagecountArray[15] = "Page 16 of 37";
			pagecountArray[16] = "Page 17 of 37";
			pagecountArray[17] = "Page 18 of 37";
			pagecountArray[18] = "Page 19 of 37";
			pagecountArray[19] = "Page 20 of 37";
			pagecountArray[20] = "Page 21 of 37";
			pagecountArray[21] = "Page 22 of 37";
			pagecountArray[22] = "Page 23 of 37";
			pagecountArray[23] = "Page 24 of 37";
			pagecountArray[24] = "Page 25 of 37";
			pagecountArray[25] = "Page 26 of 37";
			pagecountArray[26] = "Page 27 of 37";
			pagecountArray[27] = "Page 28 of 37";
			pagecountArray[28] = "Page 29 of 37";
			pagecountArray[29] = "Page 30 of 37";
			pagecountArray[30] = "Page 31 of 37";
			pagecountArray[31] = "Page 32 of 37";
			pagecountArray[32] = "Page 33 of 37";
			pagecountArray[33] = "Page 34 of 37";
			pagecountArray[34] = "Page 35 of 37";
			pagecountArray[35] = "Page 36 of 37";
			pagecountArray[36] = "Page 37 of 37";
			
			headerArray = new Array();
			headerArray[0] = "Introduction 1";
			headerArray[1] = "Introduction 2";
			headerArray[2] = "Introduction 3";
			headerArray[3] = "Introduction 4";
			headerArray[4] = "Introduction 5";
			headerArray[5] = "Introduction 6";
			headerArray[6] = "Basic XML";
			headerArray[7] = "Ajax Manager Basic Script";
			headerArray[8] = "Ajax Manager Explained 1";
			headerArray[9] = "Ajax Manager Explained 2";
			headerArray[10] = "Ajax Manager Explained 3";
			headerArray[11] = "Ajax Manager Explained 4";
			headerArray[12] = "Ajax Manager Explained 5";
			headerArray[13] = "Ajax Manager Explained 6";
			headerArray[14] = "Ajax Manager Explained 7";
			headerArray[15] = "Basic XML Example";
			headerArray[16] = "XML Basic List Menu";
			headerArray[17] = "XML Basic List Menu 2";
			headerArray[18] = "XML Interaction 1";
			headerArray[19] = "XML Interaction 2";
			headerArray[20] = "Importing Different Documents 1";
			headerArray[21] = "Importing Different Documents 2";
			headerArray[22] = "Importing Different Documents 3";
			headerArray[23] = "Importing JavaScript 1";
			headerArray[24] = "Importing JavaScript 2";
			headerArray[25] = "Importing JavaScript 3";
			headerArray[26] = "Image Gallery: Accessibility";
			headerArray[27] = "Image Gallery: Arrays";
			headerArray[28] = "Image Gallery: Objects";
			headerArray[29] = "Image Gallery: Preload 1";
			headerArray[30] = "Image Gallery: Preload 2";
			headerArray[31] = "Image Gallery: Centering";
			headerArray[32] = "Image Gallery: Fading";
			headerArray[33] = "Image Gallery: Cycling";
			headerArray[34] = "Image Gallery: Final";
			headerArray[35] = "What's Next ?";
			headerArray[36] = "Over and Out";
			
}